package com.buaaer.web;

import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;


public class Controller1 implements Controller {
    
    private static final Log LOG = LogFactory.getLog(Controller1.class);

    @Override
    public ModelAndView handleRequest(HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        
        response.setContentType("text/html; charset=utf-8");
        PrintWriter writer = response.getWriter();
        writer.write("Hello Web<br>");
        
        @SuppressWarnings("unchecked")
        Map<Object, Object> map = request.getParameterMap();
        for (Map.Entry<Object, Object> entry : map.entrySet()) {
            
            String[] values = (String[])entry.getValue();
            for (String value : values) {
                writer.write("key:" + entry.getKey() + " value:" + value + "<br>");
            }
        }
        
        
        LOG.info("controll over");
        return null;
    }


}
